package com.atguigu.controller;

import com.atguigu.entity.Dict;
import com.atguigu.result.Result;
import com.atguigu.service.DictService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@ResponseBody
@RequestMapping("/dict")
public class DictController {
    @DubboReference
    private DictService dictService;

    @RequestMapping("/findListByDictCode/{code}")
    public Result findListByDictCode(@PathVariable String code){
        List<Dict> dictList = dictService.findDictByCode(code);
        return Result.ok(dictList);
    }
    @RequestMapping("/findListByParentId/{id}")
    public Result findListByParentId(@PathVariable Long id){
        List<Dict> dictList = dictService.findDictByParentId(id);
        return Result.ok(dictList);
    }
}
